package bite;

/**
 * Creared with IntelliJ IDEA.
 * Description:【字符串中找出连续最长的数字串】读入一个字符串str，输出字符串str中的连续最长的数字串
 * User:yxd
 * Date:2022-03-25
 * Time:16:19
 */
import java.util.Scanner;
public class Day3_1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.next();
        StringBuilder sb = new StringBuilder();
        StringBuilder sb1 = new StringBuilder();
        char[] ch = s.toCharArray();
        int i = 0;
        while (i < ch.length){
            while (i < ch.length&& !Character.isDigit(ch[i])){
                i ++;
            }

            while ((i < ch.length) && Character.isDigit(ch[i])){
                sb.append(ch[i]);
                //每次统计完个数之后比较一下记录下字符串比较长的数字串
                i ++;
            }
            if(sb.length() > sb1.length()){
                sb1.delete(0,sb1.length());
                sb1.append(sb.toString());
            }
            sb.delete(0,sb.length());
        }
        System.out.println(sb1.toString());
        //或者按老师的来
        /*String cur = "";//过程变量
        String ret = "";//结果值
        int j = 0;
        for (; j < s.length(); j++) {
            char c = s.charAt(i);
            if(Character.isDigit(c)){
                cur = cur + c + "";//让其结果变成一个字符串就加个空串""
            }else{
                //比较一下结果的长度和过程的长度
                if(cur.length() > ret.length()){
                    ret = cur;//引用同样的对象
                }else{
                    cur = "";//清空
                }
            }

        }
        //最后在比较一下保证最后一个数字串也计算到
        if(j == s.length() && ret.length() < cur.length()){
            ret = cur;
        }
        System.out.println(ret);*/
    }
}
